package com.zeedev.flyingsaucer.beers.activities.tabchooser.impl;

import android.app.Activity;
import android.content.Intent;
import android.widget.TabHost;
import com.zeedev.flyingsaucer.beers.activities.beerlists.BeerList;
import com.zeedev.flyingsaucer.beers.activities.beerlists.BeerTree;
import com.zeedev.flyingsaucer.beers.activities.tabchooser.interfaces.TabModel;
import com.zeedev.flyingsaucer.modules.BeerDatabaseModule.impl.stores.StoreBeerListModel;
import mobi.zeedev.flyingsaucer.common.DataModule.BeerConstants;
import mobi.zeedev.flyingsaucer.common.DataModule.FlyingSaucerConv.Beers;
import mobi.zeedev.flyingsaucer.common.DataModule.FlyingSaucerConv.Stores.StoreBeer;

import java.io.Serializable;

public class StoreTabModel implements TabModel {
	
	@Override
	public void setTabLayout(TabHost tabHost, Activity thisIn) {
        Serializable modelIn = StoreBeerListModel.class;
		tabHost.addTab(tabHost.newTabSpec("allBeersTab")
                .setIndicator("All Beers")
                .setContent(new Intent(thisIn, BeerList.class)
                .putExtra(BeerConstants.INTENT_BEER_DB, modelIn)
                .putExtra(BeerConstants.INTENT_STORE_URL, thisIn.getIntent().getStringExtra(BeerConstants.INTENT_STORE_URL))
                ));
		
		tabHost.addTab(tabHost.newTabSpec("byStyleTab")
                .setIndicator("Style")
                .setContent(new Intent(thisIn, BeerTree.class)
                .putExtra(BeerConstants.INTENT_BEER_DB, modelIn)
                .putExtra(BeerConstants.INTENT_BEERTREE_MODE, Beers.STYLE_NAME)
                .putExtra(BeerConstants.INTENT_STORE_URL, thisIn.getIntent().getStringExtra(BeerConstants.INTENT_STORE_URL))
                ));	
				
		tabHost.addTab(tabHost.newTabSpec("byBrewerTab")
                .setIndicator("Brewer")
                .setContent(new Intent(thisIn, BeerTree.class)
                .putExtra(BeerConstants.INTENT_BEER_DB, modelIn)
                .putExtra(BeerConstants.INTENT_BEERTREE_MODE, Beers.BREWER_NAME)
                .putExtra(BeerConstants.INTENT_STORE_URL, thisIn.getIntent().getStringExtra(BeerConstants.INTENT_STORE_URL))
                ));	
		
		tabHost.addTab(tabHost.newTabSpec("newBeersTab")
                .setIndicator("New Beers")
                .setContent(new Intent(thisIn, BeerTree.class)
                .putExtra(BeerConstants.INTENT_BEER_DB, modelIn)
                .putExtra(BeerConstants.INTENT_BEERTREE_MODE, StoreBeer.SIMPLE_CREATION_DATE)
                .putExtra(BeerConstants.INTENT_STORE_URL, thisIn.getIntent().getStringExtra(BeerConstants.INTENT_STORE_URL))
                ));
		
	}
	

}
